function validate() {
    $("#formEdit")
        .validate(
        {
          rules : {
                  'protocolLevelDocumentationCategory.id' : "required",
                  'description' : "required",
                  'version' : "required"

          },
            errorElement : "label"

        })


    setEmptyDates();

}

function isOtherCategory(value){
    if (value == -2){
        $("#otherCategory").parent().parent().show()
    }
    else{
        $("#otherCategory").parent().parent().hide()

    }
    if(value == 6 || value == 7)
        $("#sampleIfcReviewForm").parent().parent().show()
    else
        $("#sampleIfcReviewForm").parent().parent().hide()
}

function beforeSave(){

    if ($('#category option:selected').val() == -2){
        $("#protocolLevelDocumentationCategoryD").val($("#otherCategory").val());
    }

    if ($('#category option:selected').val() == -1){
        $("#protocolLevelDocumentationCategoryD").val('');
    }
}


function searchTraductor(name, url, idlavel){
      alert(url)
    var id = "#" + idlavel;
    $(id).val(name);
    $("#hdNameTranslator").val(idlavel);
    windowCaller("Select translator", url, { "userName": name });

}


function closeWindows(name, id){

    $.window.closeAll();
    var hd =  "#" + $("#hdNameTranslator").val();
    $(hd).val(name);


    if(hd == "#translator")
        $("#hdTranslatorID").val(id);
    else
        $("#hdTranslatorReviewerID").val(id);

}